package com.malphi.framework.flash.jsonparse;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public enum FlashDataType {
	INT(1, Integer.class), 
	STRING(2, String.class), 
	DOUBLE(3, Double.class),
	LIST(4, List.class);

	private static Map<Integer, Class> map = new HashMap<Integer, Class>();

	static {
		for (FlashDataType type : FlashDataType.values()) {
			map.put(type.getCode(), type.getClazz());
		}
	}
	private final int code;
	private final Class clazz;

	private FlashDataType(int code, Class cls) {
		this.code = code;
		this.clazz = cls;
	}

	public int getCode() {
		return code;
	}

	public Class getClazz() {
		return clazz;
	}

	public static Class getClassByCode(int code) {
		return map.get(code);
	}
}
